{template 'common/header'}
<ol class="breadcrumb we7-breadcrumb">
<a href=""><i class="wi wi-back-circle"></i> </a>
	<li>
		{if $config_group=='enterprise'}企业信息{else}网站信息{/if}
	</li>
</ol>
<div class="clearfix">
	<form action="{php echo $this->createWebUrl('configsave', array('config_group' => $config_group,'site_code' => $_GPC['site_code'],'module_type'=>'system_welcome'))}" method="post" class="we7-form" role="form" id="form1">
		<div class="form-group">
			<label class="col-sm-2 control-label must">站点名称</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="web_name" value="{$config_row['web_name']}" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">站点logo</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_image('enterprise_logo', $config_row['enterprise_logo']);}						
				<div class="help-block">推荐使用正方形图片</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">服务电话</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="web_hotline" value="{$config_row['web_hotline']}" placeholder="服务电话" />
			</div>
		</div>
		<div id="phone" class="phone">
			<div class="form-group">
				<label class="col-sm-2 control-label">站点版本</label>
				<div class="col-sm-8" id="phones">
					<input type="text" class="form-control" name="web_version" value="{$config_row['web_version']}" placeholder="版本" />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">版权备案号</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="web_copyright" value="{$config_row['web_copyright']}" placeholder="备案信息" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">站点关键字</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="web_keywords" value="{$config_row['web_keywords']}" placeholder="站点关键字" />
			</div>
		</div>
		<div class="qq">
			<div class="form-group">
				<label class="col-sm-2 control-label">站点描述</label>
				<div class="col-sm-8">
					<textarea name='web_description' rows='3' class="form-control">{$config_row['web_description']}</textarea>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label must">企业名称</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="enterprise_name" value="{$config_row['enterprise_name']}"    />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">企业官网</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="web_url" value="{$config_row['web_url']}" placeholder="www.zhongxuan.net.cn" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">企业展示</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_image('enterprise_pic', $config_row['enterprise_pic']);}						
				<div class="help-block">推荐使用正方形图片</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">企业介绍</label>
			<div class="col-sm-8">
			{php echo tpl_ueditor('enterprise_desc', $config_row['enterprise_desc']);}
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">企业地址</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="enterprise_addr" value="{$config_row['enterprise_addr']}" placeholder="企业地址" />
			</div>
		</div>
		<div id="phone" class="phone">
			<div class="form-group">
				<label class="col-sm-2 control-label">企业联系电话</label>
				<div class="col-sm-8" id="phones">
					<input type="text" class="form-control" id="a" name="enterprise_tel" value="{$config_row['enterprise_tel']}" placeholder="企业电话" style="float: left;" />
				</div>
			</div>
		</div>
		<div class="form-group">
            <label for="name" class="col-sm-2 control-label">地址搜索</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" id="search" value="">
            </div>
            <div class="col-sm-4">
                <button type="button" class="btn btn-default search" style="margin-right:5px;">查询</button>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">地图</label>
            <div class="col-sm-8">
                <div id="container" style="width: 100%;height: 400px;"></div>
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"></label>
            <label for="name" class="col-sm-2 control-label" style="width: auto;padding-left: 15px;">经度</label>
            <div class="col-sm-3">
                <input type="text" class="form-control"  name="enterprise_gc_lng" value="{$config_row['enterprise_gc_lng']}">
            </div>
            <label for="name" class="col-sm-2 control-label" style="width: auto;">纬度</label>
            <div class="col-sm-3">
                <input type="text" class="form-control"  name="enterprise_gc_lat" value="{$config_row['enterprise_gc_lat']}">
            </div>
        </div>
		<div class="form-group">
			<label class="col-sm-2 control-label">公众号二维码</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_image('enterprise_qrcode', $config_row['enterprise_qrcode']);}						
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">小程序二维码</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_image('enterprise_programqr', $config_row['enterprise_programqr']);}						
			</div>
		</div>
		<div class="qq">
			<div class="form-group">
				<label class="col-sm-2 control-label">企业QQ</label>
				<div class="col-sm-8" >
					<input type="text" class="form-control" name="enterprise_qq" value="{$config_row['enterprise_qq']}" placeholder="企业qq"   />
				</div>
			</div>
		</div>
		<div class="qq">
			<div class="form-group">
				<label class="col-sm-2 control-label">企业邮箱</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="enterprise_email" value="{$config_row['enterprise_email']}" placeholder="企业邮箱"   />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label"></label>
			<div class="col-sm-8">
				<input type="submit" class="btn btn-primary" value="提交" />
			</div>
		</div>
	</form>
</div>
    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=CE3BZ-ZH6AW-TDQRN-ORJH6-HSPIE-7XB3W"></script>

<script>

    $(function(){

        var markers=[];

        var longitude=$("input[name='enterprise_gc_lng']").val();

        var latitude=$("input[name='enterprise_gc_lat']").val();

        if(longitude!="" && latitude!=""){

            var center = new qq.maps.LatLng(latitude, longitude);

        }else{

            var center=new qq.maps.LatLng(39.916527,116.397128);

        }

        var map = new qq.maps.Map(document.getElementById('container'),{

            center: center,

            zoom: 16

        });

        var marker = new qq.maps.Marker({

            map:map,

            position: center

        });

        markers.push(marker);

        //调用地址解析类

        geocoder = new qq.maps.Geocoder({

            complete : function(result){

                if(result.detail.location!=""){

                    map.setCenter(result.detail.location);

                    console.log(result.detail.location);

                    $("input[name='enterprise_gc_lng']").val(result.detail.location.lng);

                    $("input[name='enterprise_gc_lat']").val(result.detail.location.lat);

                    clearOverlays(markers);

                    var marker = new qq.maps.Marker({

                        map:map,

                        position: result.detail.location

                    });

                    markers.push(marker);

                }

                if(result.detail.address!=""){

                    $("input[id='search']").val(result.detail.address);

                }

            }

        });

        geocoder.getAddress(center);

        qq.maps.event.addListener(

                map,

                'click',

                function(event) {

                    $("input[name='enterprise_gc_lng']").val(event.latLng.getLng());

                    $("input[name='enterprise_gc_lat']").val(event.latLng.getLat());

                    var center = new qq.maps.LatLng(event.latLng.getLat(), event.latLng.getLng());

                    clearOverlays(markers);

                    var marker = new qq.maps.Marker({

                        map:map,

                        position: center

                    });

                    markers.push(marker);

                    geocoder.getAddress(center);

                }

        );

        $(".search").click(function(){

            var content=$("input[id='search']").val();

            if(content!=""){

                geocoder.getLocation(content);

            }

        });

    })

    function clearOverlays(overlays) {

        var overlay;

        if(overlays.length>0){

            while (overlay = overlays.pop() ) {

                overlay.setMap(null);

            }

        }



    }

</script>
{template 'common/footer'}
